package br.com.solutions.delivery.controller;

import br.com.solutions.delivery.screen.TravelMenuScreen;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

public class TravelMenuScreenController {
    
    private TravelMenuScreen form;
    
    private static TravelMenuScreenController instance;
    
    private static class NovaViagemListener implements ActionListener {
        @Override
        public void actionPerformed(ActionEvent e) {
            TravelScreenController.getInstance().showScreen();
        }
    }
    
    private TravelMenuScreenController(){
        this.form = TravelMenuScreen.getInstance();
    }
    
    public void showScreen(){
        this.form.setVisible(true);
        this.form.getBtnNovaViagem().addActionListener(new NovaViagemListener());
    }
    
    public static TravelMenuScreenController getInstance(){
        if(instance == null){
            instance = new TravelMenuScreenController();
        }
        
        return instance;
    }
   
}
